const { sequelize, DataTypes } = require("../config/Sequelize");

const rapid_user = sequelize.define(
  "user",
  {
    id: {
      type: DataTypes.INTEGER,
      primaryKey: true, //主键值
      autoIncrement: true, //自增字段
      comment: "userid 自增id", // 字段注释
      field: "rapid_user_id",
    },
    uuid: {
      type: DataTypes.UUID, //UUID
      field: "rapid_user_uuid",
      defaultValue: DataTypes.UUIDV4,//UUIDV1 or UUIDV4 默认自动生成
    },
    name: {
      type: DataTypes.STRING(20),
      field: "rapid_user_name",
    },
    age: {
      type: DataTypes.INTEGER(10),
      field: "rapid_user_age",
    },
    account: {
      type: DataTypes.STRING(20),
      field: "rapid_user_account",
    },
    password: {
      type: DataTypes.STRING(20),
      field: "rapid_user_password",
    },
    address: {
      type: DataTypes.TEXT,
      defaultValue: "",
      field: "rapid_address_age",
    },
  },
  {
    tableName: "user",
    timestamps: true,
  }
);

module.exports = rapid_user;
